<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        
        // function A() {  }
        // A.prototype.x = 10;

        // function B() {
        //     A.call(this);
        // }
        // B.prototype = A.prototype;

        function clone(obj) {
            var o = {};
            for(var key in obj) {
                o[key] = obj[key];
            }
            return o;
        }

        var a = {
            x: 10,
            y: 20,
            k: {aa: 1}
        };

        var b = {};

        for(var key in a ) {
            b[key] = a[key];
        }
        b.k.b = 55;

        console.log(b);
        console.log(a);

    </script>
</body>
</html>